package eu.dominicum.ft.pd;

import eu.dominicum.ft.pd.mao.MakeFantasyTeamMemberMAO;

/**
 * A {@link Participant}'s Fantasy Team Member.
 *
 * @author Harry Klerks
 * @since 2013M1
 */
public class FantasyTeamMember extends PersistentDomainObject {

    /**
     * The Fantasy Team Member's associated {@link TeamMember}.
     */
    private TeamMember teamMember;

    /**
     * The Fantasy Team Member's rank.
     */
    private Integer rank;

    /**
     * Flag to indicate that a Fantasy Team Member is a substitute.
     */
    private Boolean subsitute;

    /**
     * The Fantasy Team Member's Participant.
     */
    private Participant participant;

    /**
     * Makes a FantasyTeamMember object.
     *
     * @param makeFantasyTeamMemberMAO -
     * @return FantasyTeamMember
     */
    static FantasyTeamMember make(
            final MakeFantasyTeamMemberMAO makeFantasyTeamMemberMAO) {

        FantasyTeamMember newFantasyTeamMember = new FantasyTeamMember();

        newFantasyTeamMember.rank = makeFantasyTeamMemberMAO.getRank();
        newFantasyTeamMember.subsitute
                = makeFantasyTeamMemberMAO.getSubstitute();
        newFantasyTeamMember.participant
                = makeFantasyTeamMemberMAO.getParticipant();

        return newFantasyTeamMember;
    }

    /**
     * Protected constructor to satisfy JPA persistence implementations.
     */
    protected FantasyTeamMember() {

    }

    /**
     * .
     *
     * @return TeamMember
     */
    public final TeamMember getTeamMember() {
        return teamMember;
    }

    /**
     * .
     *
     * @return Integer
     */
    public final Integer getRank() {
        return rank;
    }

    /**
     * .
     *
     * @return Boolean
     */
    public final Boolean getSubsitute() {
        return subsitute;
    }

    /**
     * .
     *
     * @return Participant
     */
    public final Participant getParticipant() {
        return participant;
    }

    /**
     * .
     *
     * @param newTeamMember -
     */
    public final void changeTeamMember(final TeamMember newTeamMember) {

        this.teamMember = newTeamMember;
    }
}
